Skip to content

fix(gui): correct dialog window flags setting#725

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
add-uos:fix-355923-Fix-dialog-window-flags
Apr 28, 2026
Merged

fix(gui): correct dialog window flags setting#725
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
add-uos:fix-355923-Fix-dialog-window-flags

Conversation

@add-uos
Copy link
Copy Markdown
Contributor

@add-uos add-uos commented Apr 28, 2026

Change dialog window flags from Qt::ToolTip to Qt::Tool to fix display and interaction issues.

修复对话框窗口标志设置错误,将 Qt::ToolTip 改为 Qt::Tool
以解决显示和交互问题。

Log: 修复对话框窗口标志设置
PMS: BUG-355923
Influence: 修复后对话框能够正常显示和交互,提升用户体验。

Change dialog window flags from Qt::ToolTip to Qt::Tool to fix
display and interaction issues.

修复对话框窗口标志设置错误,将 Qt::ToolTip 改为 Qt::Tool
以解决显示和交互问题。

Log: 修复对话框窗口标志设置
PMS: BUG-355923
Influence: 修复后对话框能够正常显示和交互,提升用户体验。
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @add-uos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

这段代码修改将 dialog 的窗口标志从 Qt::ToolTip 改为 Qt::Tool。以下是对这段修改的详细审查意见:

1. 语法逻辑

  • 语法正确性:代码语法正确,setWindowFlags 是 Qt 中 QWidget 类的有效方法,参数 Qt::Tool 也是合法的枚举值。
  • 逻辑一致性:修改将窗口类型从提示框(ToolTip)变为工具窗口(Tool)。这是一个功能性的改变,需要确认是否符合产品需求。

2. 代码质量

  • 代码风格:代码风格符合 Qt 的规范,没有明显问题。
  • 注释缺失:建议在修改处添加注释,说明为什么需要将 Qt::ToolTip 改为 Qt::Tool,以便其他开发者理解修改意图。
  • 重复代码CooperationGuiHelper::setAutoFont(tipWidgt, ...) 被调用了两次,且参数不同(14 和 12)。这可能是逻辑错误或冗余调用,建议检查是否需要保留两次调用,或者是否应该设置不同的控件。

3. 代码性能

  • 性能影响Qt::ToolQt::ToolTip 在性能上的差异可以忽略不计,主要影响窗口的行为和显示方式。
  • 窗口管理Qt::Tool 窗口通常会有标题栏和更完整的窗口管理功能,可能会略微增加资源占用,但影响很小。

4. 代码安全

  • 窗口安全Qt::Tool 窗口是独立的顶层窗口,可能会被用户关闭或最小化,而 Qt::ToolTip 通常不会被用户直接关闭。需要确认这是否会影响用户体验或功能完整性。
  • 版权年份更新:文件头的版权年份从 2023-2024 更新为 2023-2026,这是合理的,但建议确保实际维护时间与声明一致。

5. 改进建议

  1. 添加注释

    // 将窗口类型从 Qt::ToolTip 改为 Qt::Tool,以支持更完整的窗口管理功能
    dialog->setWindowFlags(Qt::Tool);
  2. 检查重复代码

    • 确认 CooperationGuiHelper::setAutoFont(tipWidgt, ...) 的两次调用是否必要。如果需要设置不同的字体大小,建议使用不同的控件或变量名:
      CooperationGuiHelper::setAutoFont(titleWidget, 14, QFont::Normal);
      CooperationGuiHelper::setAutoFont(contentWidget, 12, QFont::Normal);
  3. 测试窗口行为

    • 测试 Qt::Tool 窗口在不同平台(Windows、Linux、macOS)上的行为是否符合预期。
    • 确认窗口的关闭、最小化、焦点管理等行为是否满足需求。
  4. 考虑其他窗口标志

    • 如果需要窗口始终置顶,可以结合 Qt::WindowStaysOnTopHint
      dialog->setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);

总结

这段修改在语法和逻辑上是正确的,但需要进一步确认功能需求是否支持从 Qt::ToolTipQt::Tool 的变更。建议添加注释、检查重复代码,并进行充分的跨平台测试。

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos
Copy link
Copy Markdown
Contributor Author

add-uos commented Apr 28, 2026

/forcemerge

@deepin-bot
Copy link
Copy Markdown

deepin-bot Bot commented Apr 28, 2026

This pr force merged! (status: unstable)

@deepin-bot deepin-bot Bot merged commit 7c0925a into linuxdeepin:master Apr 28, 2026
18 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants